﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RelationExpertSystem.Relation
{
    public class Son : RelationBase
    {
        private static Son _singleton = new Son();
        public static Son Instance
        {
            get { return _singleton; }
        }

        private Son() { }
        
        public override bool IsRelated(Person a, Person b)
        {
            // b = Luke
            // a = Rich
            // b is a's Son IFF b is male AND (a is b's mother or father)
            return b.Sex == Sex.Male && (a == b.Mother || a == b.Father); // skip Child for now
        }

        public override IEnumerable<IRelation> GetDependencies()
        {
            return new HashSet<IRelation>(new IRelation[] { Mother.Instance, Father.Instance });
        }
    }
}
